pp108 : onhtmlcloned Event

onhtmlcloned Event


This event is fired when a clone is created for a tuple.

Syntax

Inline HTML

<ELEMENT class="buscontrol" id=elementID onhtmlcloned="handler()"...>

Event property

elementID.onhtmlcloned = handler


Event Information

To invoke

Render the data retrieved from busdataisland using buscontrol.

Default Action

Clones the HTML element for the number of tuples present, and initiates any action associated with this event.


Event Object Properties


Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query an event object for data.

Property

Description

newHTML

Read-only. Object that denotes the clone of the HTML template to be filled with values from the tuple.


Example


This following sample code shows how the onhtmlcloned event is used to display the template depending on the availability of tuples from the backend.

<!-- HTML definition for main table data (diEmployees - ID of the data island) -->
<div class="buscontrol" onhtmlcloned="displayTemplate()" style="display:none">
    <div BusDataIsland="diEmployees" xql=".">
        <!-- HTML Content -->
    </div>
</div>
//Function called on onhtmlcloned event of the buscontrol.
function displayTemplate()
{
    //Get the HTML element
    var newTemplate = window.application.event.newHTML;
    //Make template visible. This is because the tuple is present when the function is called
    newTemplate.style.display = "";
    //Data in the template can be displayed in grid. But it is not possible to attach the grid
    //behavior before cloning the template. Since this event is called on cloning the template
    //grid control can be attached to the template. Get the TABLE element inside DIV tag
    var table = newTemplate.firstChild;
    //Attach grid behavior
    table.className = "grid";
        //Attach other properties if necessary
    table.saveState = "false";
    table.id = "myDataTable";
    application.initializeHTMLElements(table);
}

See Also


buscontrol